設定初值
利用介面A打造類別B的過程,稱之為以「類別B」實作「介面A」
interface MyInterface {
val prop: Int // abstract
val propertyWithImplementation: String
get() = "foo"
fun foo() {
print(prop)
}
}
class Child : MyInterface {
override val prop: Int = 29
}